'use strict'

function add(x){
    return new Promise(function(resolve,reject){
        console.log(`加法中，现在x=${x}`)
        resolve(x+x)
    })
}

function multipx(x){
    return new Promise(function(resolve,reject){
        setTimeout(() =>{
            console.log(`乘法中，现在x=${x}`)
            resolve(x * x)
        },1000)
        })
}

let p = new Promise(function(resolve,reject){
    console.log(`新任务`)
    resolve(10)
})

p.then(add)
    .then(add)
    .then(add)
    .then(add)
    .then(add)
    .then(add)
    .then(add)
    .then(multipx)
    .then((x) =>{
        console.log(`任务已全部完成`)
        console.log(x)
    })